import i18n from '@/lang'
import Vue from 'vue'
export const ecuColumns = [
  {
    title: i18n.t('partNumber'),
    dataIndex: 'ecuModuleId',
    width: 130,
    scopedSlots: { customRender: 'partNumber' }
  },
  {
    title: i18n.t('partName'),
    dataIndex: 'name',
    width: 130,
    scopedSlots: { customRender: 'name' }
  },
  {
    title: i18n.t('softwareCoding'),
    dataIndex: 'softwareCode',
    width: 130,
    scopedSlots: { customRender: 'softwareCode' }
  },
  {
    title: i18n.t('supplier'),
    dataIndex: 'supplier.fullName',
    width: 130,
    customRender: (text, record, index) => {
      return text || record.supplierId || '-';
    },
    scopedSlots: { customRender: 'supplier.fullName' }
  },
  {
    title: i18n.t('gdymk'),
    dataIndex: 'hlvFlag',
    width: 130,
    customRender: (text, record, index) => {
      return Vue.$store.getters.getDictCodeObj('hlvFlagDictCode')[text] || text;
    },
    scopedSlots: { customRender: 'hlvFlag' }
  },
  {
    title: i18n.t('isGydymk'),
    dataIndex: 'hvPowerFlag',
    width: 130,
    customRender: (text, record, index) => {
      return Vue.$store.getters.getDictCodeObj('hvPowerFlagDictCode')[text] || text;
    },
    scopedSlots: { customRender: 'isGydymk' }
  },
  {
    title: i18n.t('diagnosisID'),
    dataIndex: 'ecuDiaId',
    width: 130,
    scopedSlots: { customRender: 'nodeAddress' }
  },
  {
    title: i18n.t('softDid'),
    dataIndex: 'ecuDid',
    width: 130,
    scopedSlots: { customRender: 'softwareDid' }
  },
  {
    title: i18n.t('ecuHardDid'),
    dataIndex: 'ecuHardDid',
    width: 130,
    scopedSlots: { customRender: 'ecuHardDid' }
  },
  {
    title: 'KeyK',
    dataIndex: 'securityKey',
    width: 130,
    scopedSlots: { customRender: 'securityKey' }
  },
  {
    title: 'ECU IP',
    dataIndex: 'ecuIp',
    width: 130,
    scopedSlots: { customRender: 'ecuIp' }
  },
  {
    title: 'ECU 端口号',
    dataIndex: 'ecuPort',
    width: 130,
    scopedSlots: { customRender: 'ecuPort' }
  },
  {
    title: '是否有配置文件',
    dataIndex: 'hasConfig',
    width: 130,
    customRender: (text, record, index) => {
      return text === true ? i18n.t('yes') : text === false ? i18n.t('no') : '-';
    },
    scopedSlots: { customRender: 'hasConfig' }
  },
  {
    title: i18n.t('configurationFile'),
    dataIndex: 'ecuConfigDid',
    width: 130,
    scopedSlots: { customRender: 'configurationFile' }
  },
  {
    title: i18n.t('configurationFileCode'),
    dataIndex: 'configSoftwareCode',
    scopedSlots: { customRender: 'configSoftwareCode' },
    width: 130
  },
  //烧写类型
  {
    title: i18n.t('sxType'),
    dataIndex: 'ecuReprogramType',
    width: 130,
    customRender: (text, record, index) => {
      return Vue.$store.getters.getDictCodeObj('ecuReprogramTypeDictCode')[text] || text;
    },
    scopedSlots: { customRender: 'ecuReprogramType' }
  },
  //烧写条件
  {
    title: i18n.t('sxStyle'),
    dataIndex: 'ecuUpdateStyle',
    width: 130,
    customRender: (text, record, index) => {
      return Vue.$store.getters.getDictCodeObj('ecuUpdateStyleDictCode')[text] || text;
    },
    scopedSlots: { customRender: 'sxStyle' }
  },
  //烧写方式
  {
    title: i18n.t('sxWay'),
    dataIndex: 'ecuReprogramWay',
    width: 130,
    customRender: (text, record, index) => {
      return Vue.$store.getters.getDictCodeObj('ecuReprogramWayDictCode')[text] || text;
    },
    scopedSlots: { customRender: 'ecuReprogramWay'}
  },
  {
    title: '是否有文件系统',
    dataIndex: 'hasFileSystem',
    width: 130,
    customRender: (text, record, index) => {
      return text === true ? i18n.t('yes') : text === false ? i18n.t('no') : '-';
    },
    scopedSlots: { customRender: 'hasFileSystem' }
  },
  {
    title: i18n.t('encryption'),
    dataIndex: 'encryptType',
    scopedSlots: { customRender: 'encryptType' },
    customRender: (text, record, index) => {
      return Vue.$store.getters.getDictCodeObj('ecuEncryptTypeDictCode')[text] || text;
    },
    width: 130
  },
  {
    title: '子项目',
    dataIndex: 'childItem',
    width: 130,
    scopedSlots: { customRender: 'childItem' }
  },
  {
    title: '零部件编码',
    dataIndex: 'partCode',
    width: 130,
    scopedSlots: { customRender: 'partCode' }
  },
  {
    title: '模块主芯片',
    dataIndex: 'moduleMainChip',
    width: 130,
    scopedSlots: { customRender: 'moduleMainChip' }
  },
  {
    title: i18n.t('OS'),
    dataIndex: 'platform',
    width: 130,
    scopedSlots: { customRender: 'platform' }
  },
  {
    title: i18n.t('relatedModel'),
    dataIndex: 'modelCount',
    scopedSlots: { customRender: 'relatedModel' },
    width: 100
  },
  {
    title: i18n.t('relatedVersion'),
    key: 'relatedVersion',
    scopedSlots: { customRender: 'versionList' },
    width: 100
  },
  {
    title: i18n.t('timeOfCreation'),
    dataIndex: 'createTime',
    scopedSlots: { customRender: 'createTime' },
    width: 160,
    sorter: true
  },
  {
    title: i18n.t('creator'),
    dataIndex: 'createBy',
    scopedSlots: { customRender: 'createBy' },
    width: 120
  },
  {
    title: '数据来源',
    dataIndex: 'dataFrom',
    scopedSlots: { customRender: 'dataFrom' },
    customRender: (text, record, index) => {
      return Vue.$store.getters.getDictCodeObj('configModelDataFromDictCode')[text] || text;
    },
    width: 120
  },
  {
    title: '确认状态',
    dataIndex: 'syncCheck',
    scopedSlots: { customRender: 'syncCheck' },
    customRender: (text, record, index) => {
      if (text === false) {
        return '未确认';
      }
      if (text === true) {
        return '已确认';
      }
      return '';
    },
    width: 120
  },
  {
    title: i18n.t('operation'),
    dataIndex: 'action',
    width: 265,
    fixed: 'right',
    scopedSlots: { customRender: 'action' }
  }
]
export const relatedVersionTbColumns = [
  {
    key: 'versionName',
    title: i18n.t('versionName'),
    dataIndex: 'name',
    scopedSlots: { customRender: 'versionName' },
    width: 300
  },
  {
    title: i18n.t('versionCode'),
    dataIndex: 'code',
    key: 'versionCode',
    scopedSlots: { customRender: 'versionCode' },
    width: 280
  },
  {
    title: i18n.t('dependencyVersion'),
    dataIndex: 'dependenceVersion',
    key: 'dependenceVersion',
    scopedSlots: { customRender: 'dependenceVersion' },
    width: 260
  },
  {
    title: i18n.t('releaseNote'),
    dataIndex: 'releaseNotes',
    key: 'releaseNote',
    scopedSlots: { customRender: 'releaseNote' },
    width: 140,
    special: true
  }
]

export const relatedModelTbColumns = [
  {
    title: i18n.t('modelName'),
    dataIndex: 'name',
    key: 'modelName',
    scopedSlots: { customRender: 'modelName' },
    width: 220
  },
  {
    title: i18n.t('modelCode'),
    key: 'code',
    dataIndex: 'code',
    scopedSlots: { customRender: 'modelCode' },
    width: 220
  }
  // {
  //   title: i18n.t('stereotype'),
  //   key: 'trimLevel',
  //   dataIndex: 'trimLevel',
  //   scopedSlots: { customRender: 'stereotype' },
  //   width: 200
  // },
  // {
  //   title: i18n.t('stereotypeCode'),
  //   key: 'trimLevelCode',
  //   dataIndex: 'trimLevelCode',
  //   scopedSlots: { customRender: 'stereotypeCode' },
  //   width: 200
  // },
  // {
  //   title: i18n.t('installStatus'),
  //   key: 'installStatus',
  //   dataIndex: 'ecuAssembleType',
  //   scopedSlots: { customRender: 'installStatus' },
  //   width: 140
  // }
]

// 供应商列表
export const supplierlTbColumns = [
  {
    title: i18n.t('supplierId'),
    dataIndex: 'businessId',
    key: 'supplierId',
    scopedSlots: { customRender: 'supplierId' },
    width: 150
  },
  {
    title: i18n.t('supplierZhName'),
    key: 'supplierZhName',
    dataIndex: 'fullName',
    scopedSlots: { customRender: 'supplierZhName' },
    width: 300
  },
  {
    title: i18n.t('supplierZhSortName'),
    key: 'supplierZhSortName',
    dataIndex: 'shortName',
    scopedSlots: { customRender: 'supplierZhSortName' },
    width: 150
  },
  {
    title: i18n.t('supplierEnSortName'),
    key: 'supplierEnSortName',
    dataIndex: 'shortNameEn',
    scopedSlots: { customRender: 'supplierEnSortName' },
    width: 150
  },
  {
    title: i18n.t('supplierEnName'),
    key: 'supplierEnName',
    dataIndex: 'fullNameEn',
    scopedSlots: { customRender: 'supplierEnName' },
    width: 150
  },
  {
    title: i18n.t('operation'),
    key: 'operation',
    scopedSlots: { customRender: 'operation' },
    width: 100
  }
]
